home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
MCASM.RAR
/
MC_ASM.EXE
/
WROX_ASM
/
CH12
/
EFFECTS
/
PALEFF.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-14
|
1KB
|
101 lines
#include <dos.h>
#include <mem.h>
#include <stdlib.h>
#include <conio.h>
#include "graph.h"
#include "paleff.h"
VGApalette Pal;
int _r,_g,_b,r0,g0,b0;
const Cyclelen = 20;
const PaletteLen = 201;
const MaxDer = 25;
void colorwheel(int first,int count,void *Pal)
{
asm {
cld
push ds
push di
push si
les di,Pal
mov ax,es
mov ds,ax
mov ax,first
add ax,ax
add ax,first
add di,ax
mov si,di
mov bx,[si]
mov dl,[si+2]
mov cx,count
add cx,cx
add cx,count
add si,3
shr cx,1
rep movsw
shl cl,1
rep movsb
mov [di],bx
mov [di+2],dl
pop si
pop di
pop ds
}
}
void colwheeldemo1(void* v)
{
int i,j;
memset(Pal,768,0);
for(i=127;i<=191;i++)
{
Pal[i].r=60;
Pal[i].b=0;
Pal[i].g=i-127;
}
for(i=0;i<=199;i++)
for(j=0;j<=319;j++) *&MixBuffer(v)[i][j]=random(64)+127;
do
{
setDACblock(0,191,Pal);
colorwheel(127,64,Pal);
} while (!kbhit());
}
void colwheeldemo2(void* v)
{
int i,j,k,l;
memset(Pal,768,0);
for(i=127;i<=191;i++)
{
Pal[i].r=60;
Pal[i].b=0;
Pal[i].g=i-127;
}
for(i=192;i<=252;i++)
{
Pal[i].r=60;
Pal[i].b=0;
Pal[i].g=i-192;
}
for(l=0;l<=19;l++)
for(i=0;i<=19;i++)
for(j=l*10;j<=l*10+9;j++)
for(k=i*16;k<=i*16+15;k++)
if ((l % 2) == 0) *&MixBuffer(v)[j][k]=random(63)+i*10;
else *&MixBuffer(v)[j][k]=252-(random(63)+i*10);
do
{
setDACblock(0,246,Pal);
colorwheel(10,246,Pal);
delay(10);
} while (!kbhit());
}